
<template>
  <view class="activity-page">
    <!-- 活动列表 -->
    <view class="activity-list">
      <view v-for="(item, index) in activities" :key="index" class="activity-item" @tap="navigateToDetail(item)">
        <!-- 左侧图片区域 -->
        <view class="image-container" :style="{ width: imageWidth + 'rpx' }">
          <image :src="item.image" class="activity-image" mode="aspectFill"></image>
        </view>

        <!-- 右侧信息区域 -->
        <view class="info-container">
          <text class="title">{{ item.title }}</text>
          <text class="validity">有效期：{{ item.validity }}</text>
          <text class="scope">适用范围：{{ item.scope }}</text>
        </view>
      </view>
    </view>

  </view>
</template>

<style lang="scss">.activity-page {
  background-color: #f8f9fa;
  padding: 20rpx;
}

.activity-list {
  margin-bottom: 20rpx;
}

.activity-item {
  display: flex;
  background-color: #fff;
  border-radius: 16rpx;
  box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.1);
  margin-bottom: 20rpx;
  overflow: hidden;

  &:last-child {
    margin-bottom: 0;
  }
}

.image-container {
  flex-shrink: 0;
  height: 200rpx;
  overflow: hidden;
  padding: 20rpx;
}

.activity-image {
  width: 100%;
  height: 100%;
  border-radius: 16rpx;
}

.info-container {
  flex: 1;
  padding: 20rpx;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.title {
  font-size: 30rpx;
  color: #333;
  font-weight: bold;
  margin-bottom: 12rpx;
}

.validity, .scope {
  font-size: 24rpx;
  color: #666;
  line-height: 1.5;
}

.width-control {
  padding: 20rpx;
  background-color: #fff;
  border-radius: 16rpx;
  box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.1);
}

.control-label {
  font-size: 28rpx;
  color: #333;
  margin-bottom: 16rpx;
}

.width-value {
  font-size: 24rpx;
  color: #666;
  text-align: right;
}
</style>

<script>export default {
  data() {
    return {
      // 活动数据
      activities: [
        {
          id:'1',
          image: '/static/banner/banner1.jpeg',
          title: '套餐1',
          validity: '2025.10.10 - 2025.10.31',
          scope: '全部门店'
        },
        {
          id:'1',
          image: '/static/images/activity2.png',
          title: '套餐2',
          validity: '2025.06.12 - 2999.12.31',
          scope: '全部门店'
        },
        {
          id:'1',
          image: '/static/images/activity3.png',
          title: '套餐3',
          validity: '2025.05.09 - 2999.12.31',
          scope: '全国'
        },
        {
          id:'1',
          image: '/static/images/activity4.png',
          title: '套餐4',
          validity: '2024.08.07 - 2999.12.31',
          scope: '全国'
        }
      ],
      // 图片宽度，默认值为200rpx
      imageWidth: 200
    };
  },
  methods: {
    onSliderChange(e) {
      this.imageWidth = e.detail.value;
    },
    navigateToDetail(item) {
      uni.navigateTo({
        url: `/pages/package/package_detail?id=${item.id}`
      });
    }
  }
};
</script>